package de.hdu.pms.model;

import java.sql.Time;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import de.hdu.pms.model.Arbeitstag;

/**
 * @author BBV
 * 
 *         model class Pausen
 */

@Entity
@Table(name = "pausen")
public class Pausen {

	/**
	 * primary key:
	 * <ul>
	 * <li>pause_id in the database</li>
	 * <li>automatic generated value</li>
	 * </ul>
	 */
	@Id
	@GeneratedValue
	@Column(name = "pause_id")
	private Integer id;

	private Time pause_start;
	private Time pause_stop;

	/**
	 * <b>connection to the table Arbeitstag:</b>
	 * <ul>
	 * <li>Arbeitstag 1:n Pause</li>
	 * <li>one Arbeitstag has no, one ore more Pausen</li>
	 * <li>one Pause has one Arbeitstage</li>
	 * <li>atag_id is foreign key and referential integrity is on</li>
	 * </ul>
	 */
	@ManyToOne
	@JoinColumn(name = "atag_id", nullable = false)
	private Arbeitstag arbeitstag;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Time getPause_start() {
		return pause_start;
	}

	public void setPause_start(Date pause_start) {
		this.pause_start = new Time(pause_start.getTime());
	}

	public Time getPause_stop() {
		return pause_stop;
	}

	public void setPause_stop(Date pause_stop) {
		this.pause_stop = new Time(pause_stop.getTime());
	}

	public Arbeitstag getArbeitstag() {
		return arbeitstag;
	}

	public void setArbeitstag(Arbeitstag arbeitstag) {
		this.arbeitstag = arbeitstag;
	}

}
